package exam.business.service;

import exam.common.constant.ResultPort;
import exam.common.key.KeyUser;
import exam.common.util.LongUtils;
import exam.common.util.NullCheckUtil;
import exam.model.dao.TUserDAO;
import exam.model.entity.TUserEntity;
import exam.system.business.AbstractService;
import exam.system.business.BusinessServiceInfo;
/**
 * <p>UserGetService</p>
 * <p>Lay thong tin nguoi dung</p>
 * 
 * @author Phong
 * @version 19/05/2012
 */
public class UserGetService extends AbstractService {
	// tUserDAO
	private TUserDAO tUserDAO = new TUserDAO();
	@Override
	public String executeService(BusinessServiceInfo serviceInfo)
			throws Exception {
		// lay userId
		String userId = serviceInfo.getString(KeyUser.USER_ID);
		// Goi phuong thuc lay thong tin nguoi dung
		TUserEntity tUserEntity = tUserDAO.selectByPk(LongUtils.convertStringToLong(userId));
		if(NullCheckUtil.isNull(tUserEntity)) {
			return ResultPort.NONE;
		} else {
			serviceInfo.put(KeyUser.T_USER_ENTITY, tUserEntity);
			return ResultPort.SUCCESS;
		}
	}

}
